﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using My.Common.EntityHelper;
using System.Data.Linq;

namespace NCLCustomerManagement.DataTransferObjects
{
    public class BaseDTO
    {
        public IEntityHelper DTOHelper { get; set; }

        public int Key
        {
            get
            {
                return DTOHelper.GetKeyValue(this);
            }
        }

        public DateTime CreationDate { get; set; }

        public string CreatedBy { get; set; }

        public Nullable<DateTime> LastUpdatedDate { get; set; }

        public string LastUpdatedBy { get; set; }

        public Binary Timestamp { get; set; }

        public void SetUpdateTrackingInfo(string currentUser)
        {
            LastUpdatedDate = DateTime.Now;
            LastUpdatedBy = currentUser;
        }
        public void SetInsertTrackingInfo(string currentUser)
        {
            CreationDate = DateTime.Now;
            CreatedBy = currentUser;
        }
    }
}
